import React from 'react'
import PropTypes from 'prop-types'
import { Table } from 'antd'
import { formatDate } from "utils";
import moment from 'moment'
import SliderDetails from './sliderDetails'
import styles from './List.less'

class Myapply extends React.Component {
    constructor(props) {
        super(props)

        this.state = {
            lineData:"",
        }
    }
    componentDidMount() {
        const { onSearch, menu, pagination } = this.props
        const params = {
            status: menu,
            page: pagination.current
        }
        onSearch(params)
    }
    showSlider = record => {
        // this.setState({lineData:record})
        const { getSliderDetails,getWorkHistory } = this.props
        getSliderDetails(record)
        getWorkHistory(record)
        $("#sliderDetails").animate({ right: "0" });
    }
    onSliderClose = () => {
        $("#sliderDetails").animate({ right: "-500" });
    }
    render() {
        const { showCheckModal, ...applyProps } = this.props
        const columns = [
            {
                title: "档案年度",
                dataIndex: "documentYear",
                key: "documentYear",
            }, {
                title: "公证事项",
                dataIndex: "notarialMatters",
                key: "notarialMatters",
                render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
            },
            {
                title: "申请人",
                dataIndex: "applyName",
                key: "applyName",
                render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
            },
            {
                title: "收件日期",
                dataIndex: "createdTime",
                key: "createdTime",
                render: (text, record) => {
                    return (
                        <p>
                            {
                                moment(record.createdTime).format("YYYY-MM-DD")
                            }
                        </p>
                    )
                }
            },
            {
                title: "公证日期",
                dataIndex: "notarizationAt",
                key: "notarizationAt",
                render: (text, record) => {
                    return (
                        <p>
                            {
                                moment(record.notarizationAt).format("YYYY-MM-DD")
                            }
                        </p>
                    )
                }
            },
            {
                title: "承办人",
                dataIndex: "contractorUserName",
                key: "contractorUserName",
            },
            {
                title: "建档人",
                dataIndex: "createdUserName",
                key: "createdUserName",
            },
            {
                title: "所属机构",
                dataIndex: "organizationName",
                key: "organizationName",
            },
            {
                title: "操作",
                key: 'operation',
                render: (record, text) => {
                    return (
                        <div>
                            {/* <a onClick={() => showCheckModal(record)}>审核</a> */}
                            <a style={{marginLeft:10}} onClick={() => this.showSlider(record)}>审核</a>
                        </div>
                    )
                }
            }
        ];
        return (
            <div>
                <Table columns={columns} {...applyProps} />
                {/* <div id="sliderDetails" className={styles.sidePanel}> */}
                    {/* <SliderDetails datas={this.state.lineData} onClose={this.onSliderClose} /> */}
                {/* </div>    */}
            </div>
        )
    }
}

export default Myapply